package com.train.mgr.modules.system.dto.request;

import com.train.mgr.modules.system.dto.request.groups.Insert;
import com.train.mgr.modules.system.dto.request.groups.Update;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.Range;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;

/**
 * @author cxg
 * @desc UserPageReqDTO
 * @date 2024/03/09 18:05
 **/
@Data
public class UserReqDTO implements Serializable {
    /**
     * 用户id
     */
    @ApiModelProperty(name = "id", value = "用户id(新增时为空/编辑时必填)")
    @NotNull(message = "用户id必填", groups = {Update.class})
    private Long id;

    /**
     * 用户姓名
     */
    @ApiModelProperty(name = "nickName", value = "用户姓名")
    @NotBlank(message = "用户姓名必填", groups = {Insert.class, Update.class})
    @Length(max = 20, message = "用户姓名长度必须在{max}以内", groups = {Insert.class, Update.class})
    private String nickName;

    /**
     * 用户名
     */
    @ApiModelProperty(name = "username", value = "用户名")
    @NotBlank(message = "用户名必填", groups = {Insert.class, Update.class})
    @Length(max = 20, message = "用户名长度必须在{max}以内", groups = {Insert.class, Update.class})
    private String username;
    /**
     * 密码
     */
    @ApiModelProperty(name = "pass", value = "用户密码")
    @NotBlank(message = "用户密码必填", groups = {Insert.class})
    @Length(max = 18, message = "用户名长度必须在{max}以内", groups = {Insert.class})
    private String pass;

    /**
     * 用户类型
     */
    @ApiModelProperty(name = "userType", value = "用户类型（0-运营管理用户，1-企业管理用户，2-企业员工）")
    @NotBlank(message = "用户类型必填", groups = {Insert.class, Update.class})
    @Range(min = 0, max = 2, message = "用户类型值必须在{min}-{max}范围内", groups = {Insert.class, Update.class})
    private String userType;

    @ApiModelProperty(name = "userLable", value = "用户标签（非必填，长度1-10）")
    private String userLable;

    /**
     * 状态：1禁用、0启用
     */
    @ApiModelProperty(name = "enabled", value = "状态：1禁用、0启用")
    @NotNull(message = "状态必填", groups = {Insert.class, Update.class})
    @Range(min = 0, max = 1, message = "状态必须在{min}-{max}范围内", groups = {Insert.class, Update.class})
    private Integer enabled;


}
